<div class="content">

  <!--  库存信息-->
  <div class="item">
    <h2>库存信息</h2>
    <nz-row>
      <nz-col nzSpan="6">
        <span class="label">状态</span>
        <span>{{DEVICESTATUS[deviceInfo?.recycleMachine?.status]}}</span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">机器编码</span>
        <span>{{deviceInfo?.recycleMachine?.equipmentCode}}</span>
        <app-button-copy [text]="deviceInfo?.recycleMachine?.equipmentCode"></app-button-copy>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">首次入库时间</span>
        <span>{{deviceInfo?.recycleMachine?.createTime}}</span>
      </nz-col>
    </nz-row>
    <nz-row>
      <nz-col nzSpan="6">
        <span class="label">库位</span>
        <span>
          {{deviceInfo?.recycleMachine?.libraryName}}
          <i nz-icon nzType="edit" nzTheme="outline" (click)="showChangeDPModal()" *ngIf="permissionService.userPermission.has('used-store:usedDeviceList:location')"></i>
        </span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">序列号</span>
        <span>{{deviceInfo?.recycleMachine?.serialNumber}}</span>
        <app-button-copy [text]="deviceInfo?.recycleMachine?.serialNumber"></app-button-copy>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">成交入库时间</span>
        <span>{{deviceInfo?.recycleMachine?.clinchTime}}</span>
      </nz-col>
    </nz-row>
    <nz-row>
      <nz-col nzSpan="6">
        <span class="label">渠道占用</span>
        <span>{{CHANNELOCCUPY[deviceInfo?.recycleMachine?.occupyStatus]}}</span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">IMEI</span>
        <span>{{deviceInfo?.recycleMachine?.imei}}</span>
        <app-button-copy [text]="deviceInfo?.recycleMachine?.imei"></app-button-copy>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">出库时间</span>
        <span>{{deviceInfo?.recycleMachine?.outBoundTime}}</span>
      </nz-col>
    </nz-row>
    <nz-row>
      <nz-col nzSpan="6">
        <span class="label">来源</span>
        <span>{{ sourceFilter(deviceInfo?.recycleMachine?.source) }}</span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">原始编码</span>
        <span>{{deviceInfo?.recycleMachine?.oldEquipmentCode || '-'}}</span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">验收时间</span>
        <span>{{deviceInfo?.recycleMachine?.acceptanceTime || '-'}}</span>
      </nz-col>
    </nz-row>
  </div>

  <!--  机器基础信息-->
  <div class="item">
    <h2>机器基础信息</h2>
    <nz-row>
      <nz-col nzSpan="6">
        <span class="label">C端成色</span>
        <span>{{deviceInfo?.recycleMachine?.colourName}}</span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">品牌</span>
        <span>{{deviceInfo?.recycleMachine?.typeName}}</span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">颜色</span>
        <span>{{deviceInfo?.recycleMachine?.color}}</span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">版本</span>
        <span>{{deviceInfo?.recycleMachine?.version}}</span>
      </nz-col>
    </nz-row>
    <nz-row>
      <nz-col nzSpan="6">
        <span class="label">B端成色</span>
        <span>{{deviceInfo?.recycleMachine?.colourNameB}}</span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">型号</span>
        <span>{{deviceInfo?.recycleMachine?.modelName}}</span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">内存</span>
        <span>{{deviceInfo?.recycleMachine?.memory}}</span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">网络制式</span>
        <span>{{deviceInfo?.recycleMachine?.network}}</span>
      </nz-col>
    </nz-row>
  </div>

  <!--  回收信息-->
  <div class="item">
    <h2>回收信息<span><a nz-button nzSize="small" nzType="default" (click)="showReportModal(deviceInfo?.recycleMachine?.equipmentCode)">验机报告</a></span></h2>
    <nz-row>
      <nz-col nzSpan="6">
        <span class="label">回收订单</span>
        <a style="color: #2E8DED;" nzSize="small" target="_blank" [routerLink]="['/aisi-recyc/loveOrderDetails']"
           [queryParams]="{id:deviceInfo?.recycleMachine?.orderId}" nzType="default">{{deviceInfo?.orderCheckVO?.okey}}</a>
        <app-button-copy [text]="deviceInfo?.orderCheckVO?.okey"></app-button-copy>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">回收估价</span>
        <span>{{ (deviceInfo?.orderCheckVO?.uprc || 0) + (deviceInfo?.orderCheckVO?.orderAprc || 0) + (deviceInfo?.orderCheckVO?.cprc || 0) }}</span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">验机人</span>
        <span>{{deviceInfo?.orderCheckVO?.checkName}}</span>
      </nz-col>
    </nz-row>
    <nz-row>
      <nz-col nzSpan="6">
        <span class="label">回收状态</span>
        <span>{{RECYCLESTATUS[deviceInfo?.orderCheckVO?.ostat]}}</span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">实际回收金额</span>
        <span
          [ngStyle]="{
            color: ((deviceInfo?.orderCheckVO?.uprc || 0) + (deviceInfo?.orderCheckVO?.orderAprc || 0)) !== ((deviceInfo?.recycleMachine?.realValuation || 0) + (deviceInfo?.recycleMachine?.aprc || 0)) ? '#FF9900' : ''
          }"
        >
          {{ (deviceInfo?.recycleMachine?.realValuation || 0) + (deviceInfo?.recycleMachine?.aprc || 0) + (deviceInfo?.recycleMachine?.cprc || 0) }}
        </span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">验机时间</span>
        <span>{{deviceInfo?.orderCheckVO?.otime15}}</span>
      </nz-col>
    </nz-row>
  </div>

  <!--  二手信息-->
  <div class="item">
    <h2>二手信息
      <span>
        <button nz-button nzSize="small" nzType="default" (click)="usedInfo()"
                *ngIf="deviceInfo?.recycleMachine?.occupyStatus===2">二手商品信息</button>
        <!--        <button nz-button nzSize="small" nzType="default" (click)="usedUse()">上架到二手商城</button>-->
        <!--        <button nz-button nzSize="small" nzType="default"-->
        <!--                (click)="usedOccupy()">{{deviceInfo?.recycleMachine?.occupyStatus !== 2 ? '二手占用' : '取消二手占用'}}</button>-->
      <button nz-button nzSize="small" nzType="default" (click)="usedChannel(deviceInfo?.recycleMachine,2)"
              *ngIf="deviceInfo?.recycleMachine?.status===0&&deviceInfo?.recycleMachine?.occupyStatus===0&&permissionService.userPermission.has('used-store:usedDeviceList:occupy')">二手占用</button>
      <button nz-button nzSize="small" nzType="default" (click)="usedChannel(deviceInfo?.recycleMachine,0)"
              *ngIf="deviceInfo?.recycleMachine?.status===1&&deviceInfo?.recycleMachine?.occupyStatus===2&&permissionService.userPermission.has('used-store:usedDeviceList:occupy')">取消二手占用</button>
      </span>
    </h2>
    <nz-row>
      <nz-col nzSpan="6">
        <span class="label">二手状态</span>
        <span>{{RECYCLESTATUS[deviceInfo?.secondhand?.oStat]}}</span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">上架时间</span>
        <span>{{deviceInfo?.secondhand?.shelvesTime}}</span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">B端售价</span>
        <span>{{deviceInfo?.secondhand?.shopPriceB}}</span>
      </nz-col>
      <!--      <nz-col nzSpan="6">-->
      <!--        <span class="label">二手订单</span>-->
      <!--        <span>二手订单二手订单二手订单</span>-->
      <!--      </nz-col>-->
    </nz-row>
    <nz-row>
      <nz-col nzSpan="6">
        <span class="label">商品属性</span>
        <span>{{deviceInfo?.secondhand?.properties}}</span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">适用用户</span>
        <span>{{deviceInfo?.secondhand?.userType}}</span>
      </nz-col>
      <nz-col nzSpan="6">
        <span class="label">C端售价</span>
        <span>{{deviceInfo?.secondhand?.shopPriceC}}</span>
      </nz-col>
      <!--      <nz-col nzSpan="6">-->
      <!--        <span class="label">二手售后</span>-->
      <!--        <span>二手售后</span>-->
      <!--      </nz-col>-->
    </nz-row>
    <nz-row>
      <nz-col nzSpan="6">
        <span class="label" style="float: left">服务保障</span>
        <div style="display: inline-block;max-width: 184px">{{deviceInfo?.secondhand?.mallService}}</div>
      </nz-col>
      <!--      <nz-col nzSpan="6">-->
      <!--        <span class="label">质检信息</span>-->
      <!--        <span>{{deviceInfo?.secondhand?.context}}</span>-->
      <!--      </nz-col>-->
      <nz-col nzSpan="12" class="qualityRemark">
        <span class="label">质检说明</span>
        <span [nzTooltipTitle]="deviceInfo?.secondhand?.qualityResult" nzTooltipPlacement="topCenter"
              nz-tooltip>{{deviceInfo?.secondhand?.qualityResult}}</span>
      </nz-col>
    </nz-row>
    <nz-row *ngIf="deviceInfo?.secondhand?.imgs">
      <nz-col nzSpan="24" style="position: relative;padding-left: 102px">
        <span class="label" style="position: absolute;left: 0;top: 8px">图片</span>
        <nz-image-group>
          <img nz-image width="100px" [nzSrc]="url" *ngFor="let url of deviceInfo?.secondhand?.imgs" alt=""/>
        </nz-image-group>
      </nz-col>
    </nz-row>
  </div>

</div>

<!--修改库位-->
<nz-modal [(nzVisible)]="changeDLModal.visible" nzTitle="选择库位" [nzWidth]="300" nzOkText="保存"
          (nzOnCancel)="hideChangeDLModal()" (nzOnOk)="hideChangeDLModalSubmit()">
  <div *nzModalContent>
    <span>库位：</span>
    <nz-select style="width: 150px" [(ngModel)]="changeDLModal.locationId" nzPlaceHolder="请选择库位" [nzBackdrop]="true"
               nzShowSearch>
      <nz-option [nzValue]="location['id']" [nzLabel]="location['name']"
                 *ngFor="let location of locationOptions"></nz-option>
    </nz-select>
  </div>
</nz-modal>

<machine-report-modal #reportModalRef></machine-report-modal>
